import request from '@/sheep/request';

const CategoryApi = {
  // 查询分类列表
  getCategoryList: () => {
    console.log('调用getCategoryList API');
    return request({
      url: '/product/category/list',
      method: 'GET',
      custom: {
        auth: false,
        showError: false
      }
    }).then(res => {
      console.log('getCategoryList API响应:', res.code);
      return res;
    }).catch(err => {
      console.error('getCategoryList API错误:', err);
      throw err;
    });
  },
  // 查询分类列表，指定编号
  getCategoryListByIds: (ids) => {
    return request({
      url: '/product/category/list-by-ids',
      method: 'GET',
      params: { ids },
    });
  },
};

export default CategoryApi;
